package com.cryptoneedle.center.source.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import static com.cryptoneedle.center.source.constants.ConfigPropertyConstants.*;

/**
 * <p>description: 配置属性-默认配置 </p>
 *
 * @author CryptoNeedle
 * @date 2025-09-25
 */
@Getter
@AllArgsConstructor
public enum ConfigPropertyEnum {

    ODS_NAME(DORIS_DATABASE_ODS, "ODS层名称", "ods"),
    DWD_NAME(DORIS_DATABASE_DWD, "DWD层名称", "dwd"),
    DWS_NAME(DORIS_DATABASE_DWS, "DWS层名称", "dws"),
    ADS_NAME(DORIS_DATABASE_ADS, "ADS层名称", "ads"),
    DIM_NAME(DORIS_DATABASE_DIM, "DIM层名称", "dim"),
    MAPPING_NAME(DORIS_DATABASE_MAPPING, "MAPPING层名称", "mapping"),
    ;

    private final String name;
    private final String comment;
    private final String defaultValue;

    /**
     * 根据配置名称查找枚举
     */
    public static ConfigPropertyEnum findByName(String configName) {
        for (ConfigPropertyEnum config : values()) {
            if (config.name.equals(configName)) {
                return config;
            }
        }
        return null;
    }

    /**
     * 检查是否为预定义的配置项
     */
    public static boolean isPredefined(String configName) {
        return findByName(configName) != null;
    }
}